# demo07_gen.py    生成器函数
# return: 表示函数执行的终止  yield: 表示函数执行的暂停
def func01():
    a = 10
    yield a
    b = "hello"
    yield b
    c = [1, 2, 3]
    yield c
if __name__ == '__main__':
    gen = func01()
    print(gen.__next__())  # 10
    print(gen.__next__())  # hello
    for item in gen:
        print("item:", item)  # [1, 2, 3]
    print("last:", gen.__next__())  # StopIteration